package com.apci.ipreda.security.dao;

import java.util.List;

import org.springframework.util.CollectionUtils;

import com.apci.ipreda.dao.BaseDAOHibernate;
import com.apci.ipreda.security.domain.Usuario;

public class UsuarioDAOImpl extends BaseDAOHibernate implements UsuarioDAO{
	
	public Usuario findUserByUserName(String userName) {
		Object[] params = new Object[1];
		params[0] = userName; 
		
		List<Usuario> list = find(Usuario.class, "from Usuario where userName = ?", params);
		
		if (!CollectionUtils.isEmpty(list)) {
			return list.get(0);
		}
		return null;
	}
}
